package com.jic.product.controller.manage;

import com.jic.common.base.vo.RestResult;
import com.jic.product.entity.ProductAfterSale;
import com.jic.product.service.ProductAfterSaleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by WS on 2020/2/7  10: 55
 * 商品售后
 */
@RestController
@RequestMapping("/productAfterSale")
@Api(value = "商品售后", tags = {"商品售后"})
public class ProductAfterSaleController {

    @Autowired
    ProductAfterSaleService productAfterSaleService;

    /*
     *  商品售后查询
     *
     * */
    @ApiOperation(value = "商品售后信息条件查询")
    @ResponseBody
    @PostMapping(value = "/queryProductAfterSale")
    public RestResult<List<ProductAfterSale>> query(@RequestBody ProductAfterSale productSale) {
        List<ProductAfterSale> productAfterSale = new ArrayList<>();
        try {
            productAfterSale = productAfterSaleService.query(productSale);
        } catch (Exception e) {
            e.printStackTrace();
            return RestResult.error("9999", e.getLocalizedMessage());
        }

        return RestResult.success(productAfterSale);
    }
}
